﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace G.Service
{
    /// <summary>
    /// 处理用户相关的API
    /// </summary>
    public class UserService : BaseHandler
    {
        protected override void ProcessRequest(HttpContext context, out BLL.IResult result, string action)
        {
            switch (action)
            {
                case "register":
                    string email = QueryString["email"];
                    string password = QueryString["pwd"];
                    string nickname = QueryString["nickname"];
                    result = BLL.UserBLL.Register(email, password, nickname);
                    break;
                case "login":
                    string email1 = QueryString["email"];
                    string password1 = QueryString["pwd"];
                    result = BLL.UserBLL.Login(email1, password1);
                    break;
                default:
                    result = new BLL.Result() { Msg = "指定的action无效！" };
                    break;
            }
        }
    }
}